import {
    defineStore
} from 'pinia'

export const tagViewStore = defineStore('tagView', {
    state() {
        return {
            tagView: [],
        }
    },
    getters: {
        getTagView: state => state.tagView,
    },
    actions: {
        addTagView(view) {
            if (this.tagView.some(v => v.path === view.path)) return
            this.tagView.push(
                Object.assign({}, view, {
                    title: view.meta.title || 'no-name'
                })
            )
        }
    }
})